from sudoku import Puzzle

def str2num(s) :
	if s == '0' : return None
	return int(s)

file = open("sudoku.txt", "r")
total = 0

while True :
	try :
		file.next()
	except StopIteration :
		break
	grid = []
	for i in range(9) :
		grid.append(map(str2num, file.next()[0:9]))
	p = Puzzle(grid)
	print p
	print p.solve()
	total += 100 * p.grid[0][0]
	total += 10 * p.grid[0][1]
	total += p.grid[0][2]

print "total: %s" % total